package com.dataextend.service;


import com.alibaba.fastjson.JSONObject;
import com.dataextend.mapper.cluster.ReportChannelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *  用户画像 —— 渠道分析报表
 */

@Service
public class ReportChannelService {
    @Autowired
    ReportChannelMapper reportChannelMapper;

    // 双柱形图/折线图
    public JSONObject mainReport(String dataDate){
        JSONObject result = new JSONObject();
        List<JSONObject> list = reportChannelMapper.mainReport(dataDate);
        result.put("info", list);
        return result;
    }


    // 渠道表格
    public JSONObject searchTable(String startDate, String endDate, String channel){
        JSONObject result = new JSONObject();
        List<JSONObject> list = reportChannelMapper.searchTable(startDate, endDate, channel);
        int listCount =  reportChannelMapper.searchTableCount(startDate, endDate, channel);
        result.put("info", list);
        result.put("count", listCount);
        return result;
    }


    // 渠道下拉菜单
    public JSONObject channelList(){
        JSONObject result = new JSONObject();
        List<String> list = reportChannelMapper.channelList();
        result.put("info", list);
        return result;
    }


    // 渠道价值分析
    public JSONObject searchTableValue(String dataDate){
        JSONObject result = new JSONObject();
        List<JSONObject> list = reportChannelMapper.searchTableValue(dataDate);
        result.put("info", list);
        return result;
    }


}
